<!--
 * @Author: 关棺 3156298705@qq.com
 * @Date: 2024-12-19 14:55:11
 * @LastEditors: 关棺 3156298705@qq.com
 * @LastEditTime: 2024-12-19 15:14:32
 * @FilePath: \supervision-ui\src\views\file\fileVersion\components\addDialog.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <el-dialog
    :title="title"
    :visible.sync="open"
    width="500px"
    append-to-body
  >
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="文件名称" prop="fileName">
        <el-input
          disabled
          v-model="form.fileName"
          placeholder="请输入文件名称"
        />
      </el-form-item>
      <el-form-item label="上传时间" prop="uploadTime">
        <el-date-picker
          clearable
          v-model="form.uploadTime"
          type="date"
          disabled
          value-format="yyyy-MM-dd"
          placeholder="请选择上传时间"
        >
        </el-date-picker>
      </el-form-item>
      <el-form-item label="文件存储路径" label-width="110px" prop="filePath">
        <FileUpload
          ref="file"
          :limit="2"
          :fileSize="1000"
          disabled
          v-model="form.filePath"
          :fileType="[]"
        />
      </el-form-item>
      <el-form-item label="版本号" prop="infoExtend1">
        <el-input-number
          v-model="form.infoExtend1"
          disabled
          controls-position="right"
          :min="1"
        ></el-input-number>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
import { getTransfer } from "@/api/file/transfer";
export default {
  name: "FileUploadDialog",
  props: {
    title: {
      type: String,
      default: "上传文件",
    },
  },
  data() {
    return {
      open: false,
      form: {
        fileName: "",
        uploadTime: "",
        filePath: "",
        infoExtend1: 1,
      },
    };
  },
  methods: {
    visible(id) {
      this.reset();
      getTransfer(id).then(async (response) => {
        this.form = response.data;
        this.open = true;
      });
    },
    handleClose() {
      this.open = false;
    },
    reset() {
      this.form = {
        fileId: null,
        fileName: null,
        fileSize: null,
        uploadTime: null,
        uploadUserId: null,
        downloadCount: null,
        filePath: null,
        fileStatus: null,
        fileState: null,
        infoExtend1: null,
        infoExtend2: null,
        infoExtend3: null,
        infoExtend4: null,
        createBy: null,
        createDate: null,
        updateBy: null,
        updateDate: null,
        recycleStatus: null,
      };
      this.resetForm("form");
    },
  },
};
</script>

<style scoped>
.dialog-footer {
  text-align: right;
}
</style>
